﻿Public Class DAAtendance
    Inherits DataProvider


    ''' <summary>
    ''' Contructor create new DAAtendance
    ''' </summary>
    ''' <remarks></remarks>
    Shared Sub ConfigServerName(ByVal serverName As String)
        ' call constructor base class
        ConfigServer(serverName)
    End Sub

    ''' <summary>
    ''' Get all department in a company
    ''' </summary>
    ''' <param name="companyNo"></param>
    ''' <returns>Datatable</returns>
    ''' <remarks></remarks>
    Shared Function GetDepartments(ByVal companyNo As String) As DataTable
        Return Query("GetDepartmentsByCompany", {"@companyNo"}, {companyNo})
    End Function

    ''' <summary>
    ''' get all employees in a company
    ''' </summary>
    ''' <param name="companyNo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function GetEmployees(ByVal companyNo As String) As DataTable

        Return Query("GetEmployeesByCompany", {"@companyNo"}, {companyNo})

    End Function

    ''' <summary>
    ''' Get timetable of an employee
    ''' </summary>
    ''' <param name="employeeNo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function GetTimetable(ByVal employeeNo As String) As DataTable
        Return Query("GetTimetableByEmployeeNo", {"@employeeNo"}, {employeeNo})
    End Function


    ''' <summary>
    ''' Get holiday of a department
    ''' </summary>
    ''' <param name="companyNo"></param>
    ''' <param name="departmentNo"></param>
    ''' <param name="supDeptNo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function GetHolidays(ByVal companyNo As String, ByVal departmentNo As String, ByVal supDeptNo As String) As DataTable
        Return Query("GetHolidayByCompany", {"@companyNo", "@departmentNo", "@supDeptNo"}, {companyNo, departmentNo, supDeptNo})
    End Function

    ''' <summary>
    ''' Get all rest time of a timetable
    ''' </summary>
    ''' <param name="timetableNo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function GetRestTime(ByVal timetableNo As String) As DataTable
        Return Query("GetRestTimeByTimetableNo", {"@timetableNo"}, {timetableNo})
    End Function

    Shared Function GetWorkData(ByVal companyNo As String, ByVal employeeNo As String, ByVal dateFrom As String,
                                ByVal dateTo As String) As DataTable
        Return Query("GetWorkDataByEmployeeInMonth", {"@companyNo", "@employeeNo", "@dateFrom", "@dateTo"}, {companyNo, employeeNo, dateFrom, dateTo})
    End Function


    Shared Function GetCutOffDay(ByVal companyNo As String) As DataTable
        Return Query("GetCutOffDay", {"@companyNo"}, {companyNo})
    End Function

    Shared Function GetYear() As DataTable
        Return Query("GetYearInWorkData")
    End Function

    Shared Function GetAttendanceListDate() As DataTable
        Return Query("GetAttendanceListDate")
    End Function


End Class
